import {Entity} from "../../entity";
import {Alias, Column, Editor, Enum, Serialize} from "../../decorator";

export enum SupplyLevel {
    Normal = 0,
    Friendly = 1,
    VIP = 2
}

//供货商
export class Supply extends Entity {

    @Editor("String")
    @Alias("供货商名称")
    @Serialize("name")
    public name: string = "";

    @Editor("String")
    @Alias("供货商编码")
    @Serialize("code")
    public code: string = "";

    @Editor("Memo")
    @Alias("供货商描述")
    @Serialize("description")
    public description: string = "";

    @Editor("Enum")
    @Enum(SupplyLevel)
    @Alias("供货商级别")
    @Serialize("level")
    public level: number = SupplyLevel.Normal;  //0 一般供货商 1 固定供货商  2 代理

    @Editor("String")
    @Alias("联系人")
    @Serialize("person")
    public person: string = "";

    @Editor("String")
    @Alias("联系电话")
    @Serialize("phone")
    public phone: string = "";

    @Editor("String")
    @Alias("联系地址")
    @Serialize("address")
    public address: string = "";

    constructor() {
        super();
    }

    fromJSON(obj) {
        super.fromJSON(obj);
    }

    toJSON(): any {
        return super.toJSON();
    }

}


